Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
Knex & postgres connection error - error: role "admin" does not exist

I am trying to connect to postgres db image using knex. But I am getting error:- error: role "admin" does not exist

My knexfile is ass below:

module.exports = {

  development: {
    debug: true,
    client: 'pg',
    connection: {
      database: process.env.POSTGRES_DB,
      user: process.env.POSTGRES_USER,
      password: process.env.POSTGRES_PASSWORD
    },

    migrations: {
      directory: __dirname + '/src/migrations'
    },
    seeds: {
      directory: __dirname + '/src/seeds'
    }
  }
};

And my docker-compose file is:-

version: '3.1'
services:
  db:
    image: postgres
    restart: always
    volumes:
      - ./docker-data/db-data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRESS_USER: ${POSTGRES_USER}
      POSTGRESS_DB: ${POSTGRES_DB}
    ports:
      - 5432:5432
  pgadmin:
    depends_on:
      - db
    image: dpage/pgadmin4
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
    volumes:
      - ./docker-data/pgadmin-data:/root/.pgadmin
    ports:
      - 8080:80

Environment variables are straight forward

POSTGRES_USER=admin
POSTGRES_PASSWORD=admin
POSTGRES_DB=configs
PGADMIN_DEFAULT_EMAIL=admin@admin.com
PGADMIN_DEFAULT_PASSWORD=admin

Packages details:

  "knex": "^0.21.1",
  "pg": "^8.3.0"

I ran command docker-compose up and on completion i created migrations and post that i ran npx knex migrate:latest. This is resulting in error

error: role "admin" does not exist
    at Parser.parseErrorMessage (/Users/test/packages/config-server/node_modules/pg-protocol/dist/parser.js:278:15)

I am not able to debug and fix. Please help.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!